/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cart;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author frank
 */
public class CheckoutServlet extends HttpServlet
{
    @Override
    public void service(HttpServletRequest request,
        HttpServletResponse response)
        throws IOException, ServletException
    {
        HttpSession session = request.getSession();

// Get the cart
        ShoppingCart cart = (ShoppingCart) session.
            getAttribute("ShoppingCart");
            try{

	            cart.completeOrder();
			}catch(Exception e){}
	            response.sendRedirect(response.encodeRedirectURL("ShowConfirmation.jsp"));
    }
} 
